package com.csu.cphone.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.csu.common.vo.ResultVo;
import com.csu.cphone.pojo.RafflePojo;
import com.csu.cphone.service.RaffleService;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;

/**
 * @项目名称：cphone
 * @类名称：RaffleController
 * @类描述：
 * @创建人：Tangc
 * @创建时间：2017年11月25日 上午10:45:10
 * @company:
 */
@Controller
@RequestMapping("/raffle")
@Api(value = "raffle", description = "抽奖码兑奖")
public class RaffleController
{
    @Autowired
    private RaffleService raffleService;
    
    @ResponseBody
    @ApiOperation(value = "添加抽奖码", notes = "添加抽奖码")
    @RequestMapping(value = "/addRaffle/{customerId}/{number}", method = { RequestMethod.POST, RequestMethod.GET }, produces = { "application/json; charset=utf-8" })
    public ResultVo<RafflePojo> addPhoneBrand(HttpServletRequest request, HttpServletResponse response,
            @ApiParam(value = "用户id") @RequestParam(value = "customerId", required = true) Integer customerId,
            @ApiParam(value = "抽奖码数量") @RequestParam(value = "number", required = true) Integer number)
    {
        ResultVo<RafflePojo> result = new ResultVo<RafflePojo>();
        RafflePojo phoneBrand = raffleService.addRaffle(customerId,number);
        result.setData(phoneBrand);
        return result;
    }
}
